{extend name='base'/}

{block name='content'}



<!--右侧主题部分 start-->
<div class="col-xs-12 col-sm-9 col-lg-10">
    <ol class="breadcrumb" style="background-color: #f9f9f9;padding:8px 0;margin-bottom:10px;">
        <li>
            <a href="admin/article/index"><i class="fa fa-cogs"></i>
                文章管理</a>
        </li>
        <li class="active">
            <a href="">文章添加</a>
        </li>
    </ol>
    <ul class="nav nav-tabs" role="tablist">
        <li><a href="index">文章管理</a></li>
        <li class="active"><a href="">文章添加</a></li>
    </ul>
    <form class="form-horizontal" id="form"  action="upload" method="post">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">文章管理</h3>
            </div>

            <div class="panel-body">

                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">文章标题</label>
                    <div class="col-sm-9">
                        <input type="text" name="title"  class="form-control" placeholder="文章标题">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">文章作者</label>
                    <div class="col-sm-9">
                        <input type="text" name="author"  class="form-control" placeholder="文章作者">
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">所属分类</label>
                    <div class="col-sm-9">
                        <select class="js-example-basic-single form-control" name="category_cid">
                            <option value="0">请选择分类</option>
                            {foreach name='cateDate' item='vo'}
                            <option    value="{$vo['cate_id']}">{$vo['_cate_name']}</option>
                            {/foreach}

                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">标签</label>
                    <div class="col-sm-9">
                        <label class="checkbox-inline">
                            <input type="checkbox" name="" value=""> 标签1
                        </label>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="" value=""> 标签2
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">缩略图</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <div class="input-group-btn">
                                <input type="file" class="btn btn-default" name="image" accept="image/gif,image/jpeg,image/x-png"
                                onchange="photo()"/>
                                <img src=" " id="pic" name="pic1" width="50%" height="50%"/>
                                <input type="text" hidden="hidden" value="" name="imagesrc" id="imagesrc1"/>

                            </div>
                        </div>
                    </div>
                </div>


<!--                <img src="__STATIC__/index/images/2.jpg" width="100" οnclick="ta()">-->

                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">文章摘要</label>
                        <textarea name="des" id="des"style="height: 100px;width: 73%">


                    </textarea>

                    </div>

                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">文章正文</label>
                    <div class="col-sm-9">

                        <script id="container" name="content" type="text/plain">

                        </script>


                        <script type="text/javascript">
                            var editor = UE.getEditor('container');
                            var content = ue.getContent();
                                formData.append("content",container);
                        </script>

                </div>
<!--                <div class="form-group">-->
<!--                    <label for=""  class="col-sm-2 control-label">文章内容</label>-->
<!--                    <div class="col-sm-9">-->
<!--                        ​<textarea class='richtextcode col-md-12' name='richtc' cols=100 rows=6 title="Click 'code' at top-right to see text source code" > </textarea>-->
<!--                    </div>-->
                </div>
            </div>

        <button class="btn btn-primary" type="submit" name="asd">确定</button>


</div>
</form>
<!--右侧主题部分 end-->

<script type="text/javascript">

        function photo() {

            var data=new FormData($('#form')[0]);
            $.ajax({
                url:'{:url(\'Article/ajax_upload\')}',
                type:'POST',
                data:data,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                  var data='/blog/public/uploads/thum/'+data;
                   $('#pic').attr('src',data);
                    $('#imagesrc1').attr('value',data);
                   //$('#pic').val(data);

                }
            })

        }



</script>


{/block}